<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'DejaVu Sans'; font-size:11pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">При нажатии на кнопку открывается экселовский файлик, только вот почему-то не просит обновить связи! Если открываю файл из-под винды - все нормально, но если через форму аксесса, открывается файлик и связи не обновляются и нет запроса на обновление. <br />Подскажите, пожалуйста, что не так???<br />Пробовал добавить: application.asktoupdatelinks = true, application.displayalerts = true - не помогло:(<br />Офис 2010-й...</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#0000ff;">Private</span> <span style=" color:#0000ff;">Sub</span> Кнопка3_Click() </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#0000ff;">Set</span> obj = GetObject(<span style=" color:#008080;">&quot;путь к файлу xlsx&quot;</span>) </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">obj.Application.Visible = <span style=" color:#0000ff;">True</span> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">obj.Parent.Windows(1).Visible = <span style=" color:#0000ff;">True</span> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#0000ff;">End</span> <span style=" color:#0000ff;">Sub</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#0000ff;"><br /></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#0000ff;"><br /></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#0000ff;"><br /></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#0000ff;"><br /></p>
<table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" cellspacing="2" cellpadding="0">
<tr>
<td></td></tr></table>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Вот тебе рукотворный запрос на обновление. Запускается процедурой <span style=" font-weight:600;">Links_Excel_Test</span><br /></p>
<pre style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Public</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span><span style=" font-family:'Courier New,courier';"> Links_Excel_Test()</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> objExcel </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Object</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> strCaption </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">String</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier'; color:#6f002f;"><br /></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">On</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Error</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Resume</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Next</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objExcel = GetObject(, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Excel.Application&quot;</span><span style=" font-family:'Courier New,courier';">)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> objExcel </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Is</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        Err.Clear</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objExcel = CreateObject(</span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Excel.Application&quot;</span><span style=" font-family:'Courier New,courier';">)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> objExcel </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Is</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> Err.Clear: MsgBox </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Не установлен MS Excel!&quot;</span><span style=" font-family:'Courier New,courier';">, vbCritical, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Ошибка&quot;</span><span style=" font-family:'Courier New,courier';">: </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Exit</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span><span style=" font-family:'Courier New,courier';"> objExcel</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        .Visible = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">True</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        .DisplayAlerts = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">False</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        .ActivateMicrosoftApp 4&amp; </span><span style=" font-family:'Courier New,courier'; color:#008000;">'xlMicrosoftAccess = 4</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span><span style=" font-family:'Courier New,courier';"> .Workbooks</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                .Open </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;путь к файлу xls&quot;</span><span style=" font-family:'Courier New,courier';">, 0</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> MsgBox(</span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Обновить ссылки?&quot;</span><span style=" font-family:'Courier New,courier';">, vbQuestion </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Or</span><span style=" font-family:'Courier New,courier';"> vbYesNo) = vbYes </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> Excel_UpdateLinks .Item(.Count)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier'; color:#0000ff;"><br /></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objExcel = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier'; color:#0000ff;"><br /></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Private</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span><span style=" font-family:'Courier New,courier';"> Excel_UpdateLinks(objWorkbook </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Object</span><span style=" font-family:'Courier New,courier';">)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> arrLinks </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Variant</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> i </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Long</span><span style=" font-family:'Courier New,courier';">, lngRetVal </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Long</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> strFileName </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">String</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> dlgOpenFile </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Object</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#008000;">'FileDialog</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier'; color:#008000;"><br /></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">arrLinks = objWorkbook.LinkSources(1&amp;) </span><span style=" font-family:'Courier New,courier'; color:#008000;">'xlExcelLinks=1</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Not</span><span style=" font-family:'Courier New,courier';"> IsEmpty(arrLinks) </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> IsArray(arrLinks) </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">For</span><span style=" font-family:'Courier New,courier';"> i = 1 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">To</span><span style=" font-family:'Courier New,courier';"> UBound(arrLinks)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> Len(Dir$(arrLinks(i))) = 0 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                    lngRetVal = MsgBox(</span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Не нашли файл по ссылке &quot;</span><span style=" font-family:'Courier New,courier';"> &amp; </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;&quot;&quot;&quot;</span><span style=" font-family:'Courier New,courier';"> &amp; arrLinks(i) &amp; </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;&quot;&quot;&quot;</span><span style=" font-family:'Courier New,courier';"> &amp; vbNewLine &amp; _</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                       </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Искать бум?&quot;</span><span style=" font-family:'Courier New,courier';">, vbCritical </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Or</span><span style=" font-family:'Courier New,courier';"> vbYesNo, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Обновление ссылок&quot;</span><span style=" font-family:'Courier New,courier';">)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> lngRetVal = vbYes </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                            strFileName = arrLinks(i)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> Len(Dir$(strFileName)) = 0 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Do</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">While</span><span style=" font-family:'Courier New,courier';"> Len(Dir$(strFileName, vbDirectory)) = 0</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        strFileName = Left$(strFileName, InStrRev(strFileName, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;\&quot;</span><span style=" font-family:'Courier New,courier';">) - 1)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> InStr(1, strFileName, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;\&quot;</span><span style=" font-family:'Courier New,courier';">) = 0 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> strFileName = CurDir: </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Exit</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Do</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Loop</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> dlgOpenFile = Application.FileDialog(1&amp;) </span><span style=" font-family:'Courier New,courier'; color:#008000;">'msoFileDialogOpen</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span><span style=" font-family:'Courier New,courier';"> dlgOpenFile</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    .InitialFileName = strFileName</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    .AllowMultiSelect = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">False</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    .Title = </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Укажите файл для восстановления ссылки&quot;</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> .Show = -1 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                            objWorkbook.ChangeLink arrLinks(i), .SelectedItems(1), 1&amp; </span><span style=" font-family:'Courier New,courier'; color:#008000;">'xlExcelLinks</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Else</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                            MsgBox </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Не указано новое положение файла для восстановления ссылки!&quot;</span><span style=" font-family:'Courier New,courier';"> &amp; vbNewLine &amp; _</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                                    </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Ссылка не будет восстановлена.&quot;</span><span style=" font-family:'Courier New,courier';">, vbInformation</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                            strFileName = </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;&quot;</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Next</span><span style=" font-family:'Courier New,courier';"> i</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> IsArray(arrLinks) </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Erase</span><span style=" font-family:'Courier New,courier';"> arrLinks</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> dlgOpenFile = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objWorkbook = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span></pre>
<pre style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span></pre>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br />Да, кстати, тут не параметр <span style=" font-weight:600;">True</span>, а вполне себе константы - 0, 1, 2, 3. Смотри в хелпе...<br /></p>
<pre style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">obj.Workbooks.Open </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Путь к файлу&quot;</span><span style=" font-family:'Courier New,courier';">, </span><span style=" font-family:'Courier New,courier'; color:#0000ff; background-color:#f9b4b3;">True</span></pre>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#0000ff;"><br /></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#0000ff;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Вот это заремь<br /></p>
<pre style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">.ActivateMicrosoftApp 4&amp; </span><span style=" font-family:'Courier New,courier'; color:#008000;">'xlMicrosoftAccess = 4</span></pre>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br />И тут ещё поправь</p>
<pre style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">...</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Next</span><span style=" font-family:'Courier New,courier';"> i</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            objWorkbook.UpdateLink objWorkbook.LinkSources</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Erase</span><span style=" font-family:'Courier New,courier';"> arrLinks</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> </span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#008000; background-color:#f9b4b3;">'If IsArray(arrLinks) Then Erase arrLinks</span><span style=" font-family:'Courier New,courier'; background-color:#f9b4b3;">'а это убери</span></pre>
<pre style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">...</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></pre>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#0000ff;"><br /></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#0000ff;"><br /></p>
<table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" cellspacing="2" cellpadding="0">
<tr>
<td>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11px; font-weight:600; background-color:#eeeeee;">-</span><span style=" font-size:11px; font-weight:600;"> Код</span></p></td></tr>
<tr>
<td bgcolor="#efefff" style=" padding-left:7; padding-right:7; padding-top:7; padding-bottom:7;">
<pre style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Private</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span><span style=" font-family:'Courier New,courier';"> Кнопка0_Click()</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> objExcel </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Object</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> objWorkbook </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Object</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> strFileName </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">String</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier'; color:#6f002f;"><br /></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">On</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Error</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Resume</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Next</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">strFileName =  </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;D:\List.xlsx&quot;</span><span style=" font-family:'Courier New,courier'; color:#008000;">'тут уж придумай сам откуда брать путь</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> Len(Dir$(strFileName)) = 0 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> MsgBox </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Нет Файла!&quot;</span><span style=" font-family:'Courier New,courier';">: </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Exit</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objExcel = GetObject(, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Excel.Application&quot;</span><span style=" font-family:'Courier New,courier';">) </span><span style=" font-family:'Courier New,courier'; color:#008000;">'получаем объект, если он открыт (Excel запущен уже)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> objExcel </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Is</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#008000;">'не получили (не запущен)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        Err.Clear </span><span style=" font-family:'Courier New,courier'; color:#008000;">'очищаем от ошибки</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objExcel = CreateObject(</span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Excel.Application&quot;</span><span style=" font-family:'Courier New,courier';">) </span><span style=" font-family:'Courier New,courier'; color:#008000;">'создаём объект (запускаем Excel)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> objExcel </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Is</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> Err.Clear: MsgBox </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Не установлен MS Excel!&quot;</span><span style=" font-family:'Courier New,courier';">, vbCritical, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Ошибка&quot;</span><span style=" font-family:'Courier New,courier';">: </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Exit</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#008000;">'без комментариев</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span><span style=" font-family:'Courier New,courier';"> objExcel</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        .DisplayAlerts = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">False</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#008000;">'        .ActivateMicrosoftApp 4&amp; 'xlMicrosoftAccess = 4'это, если нужно переключиться на окно Access</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objWorkbook = .Workbooks.Item(Mid(strFileName, InStrRev(strFileName, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;\&quot;</span><span style=" font-family:'Courier New,courier';">) + 1)).Windows(1)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> objWorkbook </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Is</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#008000;">'не получили, книга не открыта</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                Err.Clear </span><span style=" font-family:'Courier New,courier'; color:#008000;">'очищаем от ошибки</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objWorkbook = .Workbooks.Open(strFileName, 0) </span><span style=" font-family:'Courier New,courier'; color:#008000;">'0 - ссылки не обновляем при открытии</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                objWorkbook.UpdateLink objWorkbook.LinkSources</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> Err.Number = 1004 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#008000;">'не нашли файлы для обновления ссылок</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                        Err.Clear </span><span style=" font-family:'Courier New,courier'; color:#008000;">'очищаем от ошибки</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> MsgBox(</span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Обновить ссылки?&quot;</span><span style=" font-family:'Courier New,courier';">, vbQuestion </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Or</span><span style=" font-family:'Courier New,courier';"> vbYesNo) = vbYes </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                Excel_UpdateLinks objWorkbook</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Else</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                MsgBox </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Внимание!&quot;</span><span style=" font-family:'Courier New,courier';"> &amp; vbNewLine &amp; </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Ссылки в книге &quot;&quot;&quot;</span><span style=" font-family:'Courier New,courier';"> &amp; _</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    Mid(strFileName, InStrRev(strFileName, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;\&quot;</span><span style=" font-family:'Courier New,courier';">) + 1) &amp; </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;&quot;&quot; не обновлены!&quot;</span><span style=" font-family:'Courier New,courier';">, vbInformation, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Обновление ссылок&quot;</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">ElseIf</span><span style=" font-family:'Courier New,courier';"> Err </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                        MsgBox </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Ошибка: &quot;</span><span style=" font-family:'Courier New,courier';"> &amp; Err.Number &amp; vbNewLine &amp; Err.Description, vbCritical, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Обновление ссылок&quot;</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                        Err.Clear </span><span style=" font-family:'Courier New,courier'; color:#008000;">'очищаем от ошибки</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Exit</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#008000;">'Вообще надо посмотреть, что за ошибка, попробовать обработать...</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span><span style=" font-family:'Courier New,courier';"> objWorkbook</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                    .Visible = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">True</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                    .Activate</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        .Visible = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">True</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Not</span><span style=" font-family:'Courier New,courier';"> .UserControl </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> .UserControl = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">True</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> .Windows.Count &gt; 0 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> .Windows(.Windows.Count).Activate</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Call</span><span style=" font-family:'Courier New,courier';"> SetForegroundWindow(.hWnd) </span><span style=" font-family:'Courier New,courier'; color:#008000;">'это, если нужно лицезреть Excel</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objWorkbook = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> objExcel = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Sub</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier'; color:#0000ff;"><br /></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Private</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Function</span><span style=" font-family:'Courier New,courier';"> Excel_UpdateLinks(objWorkbook </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Object</span><span style=" font-family:'Courier New,courier';">) </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Boolean</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> arrLinks </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Variant</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> i </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Long</span><span style=" font-family:'Courier New,courier';">, lngRetVal </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Long</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> strFileName </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">String</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Dim</span><span style=" font-family:'Courier New,courier';"> dlgOpenFile </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">As</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#6f002f;">Object</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#008000;">'FileDialog</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier'; color:#008000;"><br /></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">arrLinks = objWorkbook.LinkSources(1&amp;) </span><span style=" font-family:'Courier New,courier'; color:#008000;">'xlExcelLinks=1</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Not</span><span style=" font-family:'Courier New,courier';"> IsEmpty(arrLinks) </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> IsArray(arrLinks) </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">For</span><span style=" font-family:'Courier New,courier';"> i = 1 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">To</span><span style=" font-family:'Courier New,courier';"> UBound(arrLinks)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> Len(Dir$(arrLinks(i))) = 0 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                        lngRetVal = MsgBox(</span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Не нашли файл по ссылке &quot;</span><span style=" font-family:'Courier New,courier';"> &amp; </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;&quot;&quot;&quot;</span><span style=" font-family:'Courier New,courier';"> &amp; arrLinks(i) &amp; </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;&quot;&quot;&quot;</span><span style=" font-family:'Courier New,courier';"> &amp; vbNewLine &amp; _</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                           </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Искать бум?&quot;</span><span style=" font-family:'Courier New,courier';">, vbQuestion </span><span style=" font-family:'Courier New,courier'; color:#8515ea;">Or</span><span style=" font-family:'Courier New,courier';"> vbYesNo, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Обновление ссылок&quot;</span><span style=" font-family:'Courier New,courier';">)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> lngRetVal = vbYes </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                strFileName = arrLinks(i) </span><span style=" font-family:'Courier New,courier'; color:#008000;">'получаем ссылку (путь) на файл</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> Len(Dir$(strFileName)) = 0 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#008000;">'проверяем на существование (если нет файла, то идём к циклу)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Do</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">While</span><span style=" font-family:'Courier New,courier';"> Len(Dir$(strFileName, vbDirectory)) = 0 </span><span style=" font-family:'Courier New,courier'; color:#008000;">'ищем путь (папку)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                            strFileName = Left$(strFileName, InStrRev(strFileName, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;\&quot;</span><span style=" font-family:'Courier New,courier';">) - 1)</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> InStr(1, strFileName, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;\&quot;</span><span style=" font-family:'Courier New,courier';">) = 0 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span><span style=" font-family:'Courier New,courier';"> strFileName = CurDir: </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Exit</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Do</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#008000;">'если не нашли папку, получим текущий каталог</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Loop</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> dlgOpenFile = Application.FileDialog(3&amp;) </span><span style=" font-family:'Courier New,courier'; color:#008000;">'msoFileDialogFilePicker</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span><span style=" font-family:'Courier New,courier';"> dlgOpenFile</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        .InitialFileName = strFileName</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        .AllowMultiSelect = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">False</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        .Title = </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Укажите файл для восстановления ссылки&quot;</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span><span style=" font-family:'Courier New,courier';"> .Show = -1 </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Then</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                                objWorkbook.ChangeLink arrLinks(i), .SelectedItems(1), 1&amp; </span><span style=" font-family:'Courier New,courier'; color:#008000;">'xlExcelLinks</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Else</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                                MsgBox </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Не указано новое положение файла для восстановления ссылки!&quot;</span><span style=" font-family:'Courier New,courier';"> &amp; vbNewLine &amp; _</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                                        </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Ссылки не будут обновлены.&quot;</span><span style=" font-family:'Courier New,courier';">, vbInformation, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Обновление ссылок&quot;</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Erase</span><span style=" font-family:'Courier New,courier';"> arrLinks</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Exit</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Function</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">With</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                strFileName = </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;&quot;</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Else</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                MsgBox </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Не указано новое положение файла для восстановления ссылки!&quot;</span><span style=" font-family:'Courier New,courier';"> &amp; vbNewLine &amp; _</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                        </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Ссылки не будут обновлены.&quot;</span><span style=" font-family:'Courier New,courier';">, vbInformation, </span><span style=" font-family:'Courier New,courier'; color:#008080;">&quot;Обновление ссылок&quot;</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Erase</span><span style=" font-family:'Courier New,courier';"> arrLinks</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Exit</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Function</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">                </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Next</span><span style=" font-family:'Courier New,courier';"> i</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            objWorkbook.UpdateLink objWorkbook.LinkSources </span><span style=" font-family:'Courier New,courier'; color:#008000;">'обновим ссылки в книге</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">            </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Erase</span><span style=" font-family:'Courier New,courier';"> arrLinks</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">        </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">    </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">End</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">If</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">Excel_UpdateLinks = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">True</span></pre>
<pre style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; color:#0000ff;">Set</span><span style=" font-family:'Courier New,courier';"> dlgOpenFile = </span><span style=" font-family:'Courier New,courier'; color:#0000ff;">Nothing</span></pre>
<pre style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#0000ff;">End</span> <span style=" color:#0000ff;">Function</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#0000ff;"><br /></pre></td></tr></table></body></html>